#ifndef _SPI_HARD_H_
#define _SPI_HARD_H_
#include "def.h"

	#define Dummy_Byte    0xA5

	#define SPI_HARD			SPI1

	#define SPI_HARD_CS_INIT()	GPIOA_MODE4=OUTPUT_MODE_50MHZ;GPIOA_CNF4=OUT_G_PP;//NSS_GPIO
	#define SPI_HARD_CS_HIGH()	GPIOA_SET=(1<<4)
	#define SPI_HARD_CS_LOW() 	GPIOA_CLR=(1<<4)

	typedef enum {
		CHIP_SPI_MCP2515,
		CHIP_SPI_MAX,
	}enumChipType;

	extern uint8_t SPI_HARD_Inner_SendByte(uint8_t byte);

	extern void SPI_HARD_SendBuffer(U8 iChipSel,U8 iRegAdd,U8* pData, U8 length);

	
	extern U8 SPI_HARD_ReadByte(U8 iChipSel,U8 iRegAdd);
	extern void SPI_HARD_SendByte(U8 iChipSel,U8 iRegAdd,U8 iData);
	extern void SPI_HARD_ReadNBytes(U8 iChipSel,U8 iRegAdd,U8 *p,U16 len);
	extern void SPI_HARD_Init(void);
	//////////////////////////////////////////////////////////////////////////
#endif

/******************* (C) COPYRIGHT 20090724 JQilin*****END OF FILE****/

